package com.mobxrn;

import android.app.Application;
import com.brentvatne.react.ReactVideoPackage;
import com.facebook.react.ReactApplication;
import com.microsoft.codepush.react.CodePush;
import com.yunpeng.alipay.AlipayPackage;
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
import com.jeepeng.react.xgpush.PushPackage;
import com.RNFetchBlob.RNFetchBlobPackage;
import com.rnfs.RNFSPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.theweflex.react.WeChatPackage;
import com.beefe.picker.PickerViewPackage;
import com.horcrux.svg.SvgPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.kishanjvaghela.cardview.RNCardViewPackage;
import com.yunpeng.alipay.AlipayPackage;
import cn.reactnative.modules.update.UpdatePackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.mehcode.reactnative.splashscreen.SplashScreenPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.List;
import com.github.yamill.orientation.OrientationPackage;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    protected String getJSBundleFile(){
      return CodePush.getJSBundleFile();
    }

    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }


    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
            new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG),
            new AlipayPackage(),
            new AsyncStoragePackage(),
            new PushPackage(),
            new RNFetchBlobPackage(),
            new RNFSPackage(),
            new RNDeviceInfo(),
            new WeChatPackage(),
            new PickerViewPackage(),
            new SvgPackage(),
            new PickerPackage(),
            new RNCardViewPackage(),
            new UpdatePackage(),
            new VectorIconsPackage(),
            new SplashScreenPackage(),
            new OrientationPackage(),  
            new ReactVideoPackage()
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}
